package com.xinqi.common.core.enums;

public enum CourseExamQuestionEnum {
    JUDGE(1, "判断题"), SINGLE_CHOICE(2, "单项选择题"), MULTIPLE_CHOICE(3, "多项选择题"), UNCERTAIN_MULTIPLE_CHOICE(4, "不定项选择题"), FILL_IN_BLANK(5, "填空题"), ESSAY_QUESTION(6, "简答题");
    private Integer code;
    private String message;

    CourseExamQuestionEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static CourseExamQuestionEnum match(int key) {

        CourseExamQuestionEnum result = null;

        for (CourseExamQuestionEnum s : values()) {
            if (s.getCode() == key) {
                result = s;
                break;
            }
        }

        return result;
    }

    public static CourseExamQuestionEnum catchMessage(String msg) {

        CourseExamQuestionEnum result = null;

        for (CourseExamQuestionEnum s : values()) {
            if (s.getMessage().equals(msg)) {
                result = s;
                break;
            }
        }

        return result;
    }


}
